<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>CustomFilterCallback</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">CustomFilterCallback()</font></b></p>
<p><b>语法</b></p><blockquote>
<font color="#3A3966"><b>CustomFilterCallback</b></font>(@FilterCallback())</blockquote>

</blockquote>
<b>概要</b><br><blockquote>

指定将要求每个像素是在绘图操作的一部分回调<font color="#924B72">＃PB_2DDrawing_CustomFilter</font><a href="drawingmode.html">绘图模式</a>。. 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>@FilterCallback()</i></td>
<td width="90%"> 
这是用来调用的回调函数的地址。必须要具备以下形式： 
<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">Procedure</font></b> <font color="#3A3966">CustomCallback</font>(x, y, SourceColor, TargetColor)
    <font color="#3A3966">;</font>
    <font color="#3A3966">; Calculate ResultColor from the given input</font>
    <font color="#3A3966">;</font>
    <b><font color="#3A3966">ProcedureReturn</font></b> ResultColor
  <b><font color="#3A3966">EndProcedure</font></b>
</font></pre>

回调将被称为对于每个被画成一个调用的结果绘制功能，如像素<a href="line.html">Line()</a>，<a href="box.html">Box()</a> 或<a href="drawtext.html">DrawText()</a>。所述SourceColor参数指定在拉伸操作中给出的颜色和TargetColor参数指定在绘图区域中的目标像素的颜色。这两种颜色总是32位带alpha通道独立输出的颜色深度。回调必须计算目标像素应具有拉伸后该并返回的颜色。<br><br>和y在回调坐标接收的X总是相对于绘图输出的左上角. The coordinates are not affected by any calls to <a href="setorigin.html">SetOrigin()</a> or <a href="clipoutput.html">ClipOutput()</a>. 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>
无.


</blockquote><p><b>备注</b></p><blockquote>

此回调将被调用多次 （用于绘制每个像素） 所以它应该是很小，速度快，对绘图的性能没有太大的影响。<br><br>注意： <font color="#924B72">＃PB_2DDrawing_CustomFilter</font><a href="drawingmode.html">绘图模式</a>仅适用于<a href="../image/imageoutput.html">ImageOutput()</a>和<a href="../gadget/canvasoutput.html">CanvasOutput()</a>。 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">Procedure</font></b> <font color="#3A3966">FilterCallback</font>(x, y, SourceColor, TargetColor)
    <font color="#3A3966">; Take only the Red component from the Source, do not modify the others</font>
    <b><font color="#3A3966">ProcedureReturn</font></b> <font color="#3A3966">RGBA</font>(<font color="#3A3966">Red</font>(SourceColor),<font color="#3A3966"> Green</font>(TargetColor),<font color="#3A3966"> Blue</font>(TargetColor),<font color="#3A3966"> Alpha</font>(TargetColor))
  <b><font color="#3A3966">EndProcedure</font></b>
  
<font color="#3A3966">  UseJPEGImageDecoder</font>()

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 400, 200, "2DDrawing Example", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#3A3966">    LoadImage</font>(1, <font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data/Textures/clouds.jpg")
  
    <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateImage</font>(0, 400, 200) <b><font color="#3A3966">And</font></b> <font color="#3A3966">StartDrawing</font>(<font color="#3A3966">ImageOutput</font>(0))
<font color="#3A3966">      DrawImage</font>(<font color="#3A3966">ImageID</font>(1), 0, 0, 400, 200)
      
<font color="#3A3966">      DrawingMode</font>(<font color="#924B72">#PB_2DDrawing_CustomFilter</font>)      
<font color="#3A3966">      CustomFilterCallback</font>(@FilterCallback())
<font color="#3A3966">      Circle</font>(100, 100, 100, $0000FF)   
<font color="#3A3966">      Circle</font>(300, 100, 100, $000000)
      
<font color="#3A3966">      StopDrawing</font>() 
<font color="#3A3966">      ImageGadget</font>(0, 0, 0, 400, 200,<font color="#3A3966"> ImageID</font>(0))
    <b><font color="#3A3966">EndIf</font></b>
    
    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

<br>
<p><img src="../HelpPictures/customfilter.png"></p>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="drawingmode.html">DrawingMode()</a>, <a href="customgradient.html">CustomGradient()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=conicalgradient.html>ConicalGradient()</a> - <a href="index.html">2DDrawing 索引</a> - <a href="customgradient.html">CustomGradient()</a> -&gt;<br><br>

</body></html>